package com.itheima.reggie.controller;

import com.itheima.reggie.common.ResultInfo;
import com.itheima.reggie.domain.Dish;
import com.itheima.reggie.service.DishService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
//分类菜品管理
@RestController
public class DishController {

    @Autowired
    private DishService dishService;

    //根据分类id+状态查询菜品列表
    @GetMapping("/dish/list")
    public ResultInfo findList(Long categoryId, Integer status) {//接受传入分类id和状态
        //调用service层查询
        List<Dish> dishList = dishService.findList(categoryId, status);
        return ResultInfo.success(dishList);//返回结果
    }


}
